package com.baizhi.service.impl;

import com.baizhi.entity.Section;
import com.baizhi.mapper.SectionMapper;
import com.baizhi.service.SectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SectionServiceImpl implements SectionService {

    @Autowired
    private SectionMapper sectionMapper;

    @Override
    public void insertSection(Section section) {
        sectionMapper.insertSection(section);
    }

    @Override
    public void deleteById(Integer sectionId) {
        sectionMapper.deleteById(sectionId);
    }

    @Override
    public void deleteSelect(Integer[] ids) {
        sectionMapper.deleteSelect(ids);
    }

    @Override
    public void updateById(Section section) {
        sectionMapper.updateById(section);
    }

    @Override
    public List<Section> selectPage(String sectionName, Integer pageNum, Integer pageSize) {
        Integer offset = (pageNum-1)*pageSize;
        Integer limit = pageSize;
        return sectionMapper.selectPage(sectionName, offset, limit);
    }

    @Override
    public Section selectById(Integer sectionId) {
        return sectionMapper.selectById(sectionId);
    }

    @Override
    public Integer selectTotalRows(String sectionName) {
        return sectionMapper.selectTotalRows(sectionName);
    }
}
